<style type="text/css">
    .bjui-pageHeader{
        font-size: 18px;
        font-weight: bold;
    }
    .form{
        padding: 15px;
    }

    .litpic_btn{
        float: right;
    }
        .picture_item {
        border: 5px solid #cccccc;
        float: left;
        height: 120px;
        overflow: hidden;
        padding: 5px;
        position: relative;
        width: 120px;
        margin-right: 5px;
    }
    .picture_item .picture_del {
        background-color: #ff6600;
        bottom: 5px;
        color: #ffff66;
        cursor: pointer;
        display: none;
        font-size: 12px;
        height: 20px;
        position: absolute;
        right: 5px;
        text-align: center;
        width: 43px;
        padding-top: 3px;
        z-index: 2;
    }
    .picture_item .picture_go_up {
        background-color: green;
        color: #fff;
        cursor: pointer;
        font-size: 14px;
        height: 20px;
        padding-left: 6px;
        padding-top: 3px;
        position: absolute;
        top: 50%;
        width: 40px;
        z-index: 2;
    }
</style>

<!--  -->
<script type="text/javascript">
    $(function () {
        //跳转链接
        $('#CK_JumpUrl').click(function(){
                var inputs = $(this).parents('tr').find('input');
                if($(this).attr('checked')) {
                    $('#JumpUrlDiv').show();

                }else {
                    $('#JumpUrlDiv').hide();
                }
         });
});

    //浏览上传的文件
    var editor = KindEditor.editor({
        fileManagerJson : '{:U("Attachment/filemanager")}'
    });

    //缩略图浏览服务器上传
    $('#BrowerPicture').click(function() {
        editor.loadPlugin('filemanager', function() {
        editor.plugin.filemanagerDialog({
            viewType : 'VIEW',
            dirName : 'image',
            clickFn : function(url, title) {
                $('#litpic').val(url);
                editor.hideDialog();
                }
            });
        });
    });
    //缩略图浏览本地上传
    function doc_upload_success(file, data) {
        var json = $.parseJSON(data)
        $(this).bjuiajax('ajaxDone', json)
        if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
            $('#litpic').val(json.filename);
        }
    }

</script>

<script type="text/javascript" charset="utf-8">
        KindEditor.create('#j_form_content', {
            uploadJson : '{:U("Attachment/uploads")}',
            fileManagerJson : '{:U("Attachment/filemanager")}',
            allowFileManager : true,
            extraFileUploadParams: {
                session_id : '<?php echo session_id() ?>'
            },
            height : 400,
            afterBlur: function () {
              this.sync();
            }
        });
</script>

<!-- -->
<div class="bjui-pageHeader">
    <div class="glyphicon glyphicon-th-large">添加文章</div>
</div>
<div class="bjui-pageContent">
    <div class="form">
        <form method='post'  data-toggle="validate" action="{:U('Article/editPost')}">
            <table class="table table-bordered table-hover table-striped table-top">
                <tr>
                    <td>标题：</td>
                    <td>
                        <input type="text" name="title" size="30"  data-rule="required" data-tip="请填写标题" data-ok="OK" value="{$vo.title}" />
                    </td>
                </tr>
                <tr>
                    <td>副标题：</td>
                    <td>
                        <input type="text" name="shorttitle"  size="30" value="{$vo.shorttitle}"/>
                    </td>
                </tr>
                <tr>
                    <td>文章来源：</td>
                    <td>
                        <input type="text" name="copyfrom"  size="30" value="{$vo.copyfrom}" />
                    </td>
                </tr>
                <tr>
                    <td>作者：</td>
                    <td>
                        <input type="text" name="author"  size="30" value="{$vo.author}"/>
                    </td>
                </tr>
                <tr>
                    <td>自定义属性：</td>
                    <td>
                        <foreach name='flagtypelist' item='v'>
                            <label><input type='checkbox' name='flags[]' value='{$key}' <if condition="$key eq B_JUMP">id="CK_JumpUrl"</if> <if condition="(in_array($key,$vo['flag']))">checked="checked"</if> /> {$v}</label>&nbsp; 
                        </foreach>
                </td>
            </tr>
            <tr id="JumpUrlDiv" <if condition="($vo.flag & B_JUMP) eq 0">style="display:none;"</if>>
                <td>跳转网址：</td>
                <td>
                    <input type="text" name="jumpurl"  size="30" value="{$vo.jumpurl}"/>
                </td>
            </tr>
            <tr>
                <td>所属栏目：</td>
                <td>
                    <select name="cid" data-toggle="selectpicker" data-width="200">
                        <foreach name='cate' item='v'>
                            <option value="{$v.id}" <if condition="$vo.cid eq $v['id']">selected="selected"</if>>{$v.delimiter}{$v.name}</option>
                        </foreach>
                </select>
            </td>
        </tr>
        <tr>
            <td>缩略图：</td>
            <td>
                <input type="text" name="litpic" id="litpic"  value="{$vo.litpic}" />
                <button type="button" class="btn-default" data-icon="folder" id="BrowerPicture">选择站内图片</button>
                <div style="display:inline-block; vertical-align:middle;">
                    <div id="doc_pic_up" data-toggle="upload" data-uploader="{:U('Attachment/uploadPlus',array('dir'=>'image'))}" 
                            data-file-size-limit="1024000000"
                            data-file-type-exts="*.jpg;*.png;*.gif;*.mpg"
                            data-multi="true"
                            data-on-upload-success="doc_upload_success"
                            data-icon="cloud-upload">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>标题颜色：</td>
            <td>
                <input type="text" name="color" data-toggle="colorpicker" class="inp_small iColorPicker" id="color"  size="30" data-bgcolor="true" readonly="" style="background:{$vo.color}" value="{$vo.color}"/>
            </td>
        </tr>
        {$field_html}
        <tr>
            <td>关键词：</td>
            <td>
                <input type="text" name="keywords"  size="30" value="{$vo.keywords}" />
                <span class="tip">多关键词之间用“,”隔开</span>
            </td>
        </tr>
        <tr>
            <td>摘要：</td>
            <td>
                <textarea name="description" class="tarea_default" cols="30" rows="5">{$vo.description}</textarea>
            </td>
        </tr>

        
    <tr>
        <td>评论：</td>
        <td>
            <input type="radio" name="commentflag" value="1" checked="checked" />
            允许
            <input type="radio" name="commentflag" value="0" />
            禁止
        </td>
    </tr>
    <input type="hidden" name="id" value="{$vo.id}" />
    <input type="hidden" name="pid" value="{$pid}" />
    <input type="hidden" name="model_name" value="{$model_name}">
</table>
</form>
</div>
</div>
<div class="bjui-pageFooter">
<ul>
<li>
<button type="button" class="btn-close" data-icon="close">关闭</button>
</li>
<li>
<button data-icon="save" class="btn btn-default" type="submit">保存</button>
</li>
</ul>
</div>